<?php 
	session_start();

	if (isset($_SESSION['username']) && isset($_SESSION['uid'])) {
		require('../../Controller/MaintainSystem_controller.php');
		$admin = new MaintainSystem();
		$account = $_SESSION['username'];
		$uid = $_SESSION['uid'];
		if($admin->checkUser($account, $uid)) {
			
			//修改使用者資料
			$id = $_POST["id"];
			$name = $_POST["name"];
			$birth = $_POST["birth"];
			$tel = $_POST["tel"];
			$admin->modifyUser($id, $name, $birth, $tel);
			header("location:./UserInfo.php");
		}else {
			header("location:../../login.php");
		}	
	}else {
		header("location:../../login.php");
	}
	
?>